﻿//
// XN4SL - Xna Framework for Silverlight.
//
using System;

namespace Xn4Sl.Framework.Media
{
    /// <summary>
    /// Provides an information about a song. 
    /// </summary>
    public sealed class Song : IEquatable<Song>, IDisposable
    {
        /// <summary>
        /// Creates the song with the specified name.
        /// </summary>
        /// <param name="name">song's filename</param>
        public Song(string name)
        {
            this.name = name;
        }

        /// <summary>
        /// Filename of the song.
        /// </summary>
        private string name;
        public string Name 
        {
            get
            {
                return this.name;
            }
        }

        /// <summary>
        /// Immediately releases the unmanaged resources used by this object.
        /// </summary>
        public void Dispose()
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Determines whether the specified System.Object is equal to this song.
        /// </summary>
        /// <param name="obj">System.Object to compare with this instance.</param>
        /// <returns>true if the objects are equal; false otherwise.</returns>
        public override bool Equals(object obj)
        {
            return obj.GetHashCode() == this.GetHashCode();
        }

        /// <summary>
        /// Determines whether the specified is equal to this song.
        /// </summary>
        /// <param name="other">to compare with this instance.</param>
        /// <returns>true if the objects are equal; false otherwise.</returns>
        public bool Equals(Song other)
        {
            return this.Equals(other);
        }

        /// <summary>
        /// Gets the hash code for this instance.
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            return this.name.GetHashCode();
        }

        /// <summary>
        /// Returns a System.String representation of the song.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return this.name;
        }
    }
}
